<template>
    <div>
        <input type="button" value="+1" @click="addNum"/>
        {{ num }}
        <input type="button" value="-1" @click="subNum"/>
    </div>
</template>

<script>
    export default{
        data(){
            return{
                num:0
            }
        },
        methods:{
            addNum(){
                this.num++
            },
            subNum(){
                this.num--
            }
        }
    }
</script>

<style scoped>
    .example{
        color: red;
    }
</style>